stage.set_background("moon")
sprite = codesters.Sprite("astronaut1")
sprite.go_to(-125, -150)
glorp = codesters.Sprite("alien1")
glorp.go_to(100, -125)
rock = codesters.Sprite("asteroid")
rock.go_to(100, 75)
sprite.say("What do planets read?")
t = codesters.Teacher()
try:
tval1 = t.find_block('def')[0][1]
except:
tval1 = "DNE"
try:
params = t.find_function('say')
tval2a = params[1][1].lower().replace(' ', '')
tval2b = t.get_indent_at_line(params[1][0])
except:
tval2a = "DNE"
tval2b = "DNE"
t1 = TestObjective()
t1.add_success('click' in tval1, "Great job!")
t1.add_failure('click' not in tval1, "Did you add a Click event?")
t1.add_failure(tval1 == "DNE" or tval1 == None, "Did you add a Click event?")
t2 = TestObjective()
t2.add_success('cometbooks' in tval2a and tval2b == 4, "Great job!")
t2.add_failure("hello, name" in tval2a, "Did you change the text in the Say command?")
t2.add_failure(tval2b != 4, "Make sure your Say command is indented four spaces inside the Click event.")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)